import React, { Component } from 'react'
import Loading from 'components/loding/loding'


import AuthRoute from 'components/AuthRoute/index'

// 创建路由容器
import { Router, Route, Switch } from 'react-router-dom'
// 导入history封装
import history from 'utils/history'

// 导入登录页面
// 导入容器
// import Login from 'pages/Login/Login.js'
// import Layout from 'pages/Layout/Layout.js'
// 懒加载
const Login = React.lazy(() => import('pages/Login/Login.js'))
const Layout = React.lazy(() => import('pages/Layout/Layout.js'))

export default class Add extends Component {
    render() {
        return (
            <div>
                <Router history={history}>
                    <React.Suspense fallback={<Loading />}>
                        <Switch>
                            {/* exact是相当于全等的意思 */}
                            <Route path='/login' component={Login} />
                            <AuthRoute path="/" component={Layout} />
                        </Switch>
                    </React.Suspense>
                </Router>
            </div>
        )
    }
}
